package com.xauto.pioneer.appuser.model;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Ellis.Li on 2017/5/12.
 */
public class CarRefuelDetailInfo extends BaseModel<CarRefuelDetailInfo> {

    /** ID*/
    public String car_refuel_id;
    /** 名称*/
    public String car_order_no;
    /** 名称*/
    public String car_refuel_amount;
    /** 名称*/
    public String car_refuel_amount_foramt;
    /** 名称*/
    public String plate_no;
    /** 名称*/
    public String car_refuel_status_id;
    /** 名称*/
    public String car_refuel_status_name;
    /** 名称*/
    public String car_refuel_status_style_color;
    /** 名称*/
    public String car_refuel_comment;
    /** 名称*/
    public String car_refuel_comment_style_color;
    //public List<Image> refuel_image_list;
    public List<String> refuel_image_list;
    public String time;

    @Override
    public CarRefuelDetailInfo parse(JSONObject jsonObject) {
        if(jsonObject != null) {
            car_refuel_id = jsonObject.optString("car_refuel_id");
            car_order_no = jsonObject.optString("car_order_no");
            car_refuel_amount = jsonObject.optString("car_refuel_amount");
            car_refuel_amount_foramt = jsonObject.optString("car_refuel_amount_foramt");
            plate_no = jsonObject.optString("plate_no");
            car_refuel_status_id = jsonObject.optString("car_refuel_status_id");
            car_refuel_status_name = jsonObject.optString("car_refuel_status_name");
            car_refuel_status_style_color = jsonObject.optString("car_refuel_status_style_color");
            car_refuel_comment = jsonObject.optString("car_refuel_comment");
            car_refuel_comment_style_color = jsonObject.optString("car_refuel_comment_style_color");
            time= jsonObject.optString("time");
            JSONArray imageList = jsonObject.optJSONArray("refuel_image_list");
            Log.e("获取图片信息",jsonObject.optJSONArray("refuel_image_list").toString());
            refuel_image_list=new ArrayList();
            if (imageList != null && imageList.length() > 0){
                for (int i=0,size = imageList.length();i<size;i++){
                    Image image = new Image().parse(imageList.optJSONObject(i));
                   // refuel_image_list.add(image);
                    refuel_image_list.add(image.source.toString());
                }

            }
            return this;
        }
        return null;
    }
}
